function Dict(dictName) {
    this.url='/manage/base/dict/dictSelect?appFieldName=';
    this.dictData=[];
    this.dictName=dictName;
    //方法
    if(typeof this.dictFormat !="function")
    {
        Dict.prototype.dictFormat=function(value)
        {
            for (var i=0;i<this.dictData.length;i++)
            {
                var item = this.dictData[i];
                if (item.fieldValue == value)
                {
                    return item.valueComment;
                }
            }
        };

        Dict.prototype.select = function(control){
            //设置Select2的处理
            control.select2({
                allowClear: true,
                escapeMarkup: function (m) {
                    return m;
                }
            });

            //绑定Ajax的内容
            control.empty();//清空下拉框
            $.each(data, function (i, item) {
                control.append("<option value='" + item.fieldValue + "'> " + item.valueComment + "</option>");
            });
        }
    };

    $this = this;
    $.getJSON(BASE_PATH+this.url+this.dictName, function (data) {
        $this.dictData = data;
    });
 }

function DictFromUrl(url) {
    this.dictData=[];
    //方法
    if(typeof this.dictFormat !="function")
    {
        Dict.prototype.dictFormat=function(value)
        {
            for (var i=0;i<this.dictData.length;i++)
            {
                var item = this.dictData[i];
                if (item.fieldValue == value)
                {
                    return item.valueComment;
                }
            }
        };

        Dict.prototype.select = function(control){
            //设置Select2的处理
            control.select2({
                allowClear: true,
                escapeMarkup: function (m) {
                    return m;
                }
            });

            //绑定Ajax的内容
            control.empty();//清空下拉框
            $.each(data, function (i, item) {
                control.append("<option value='" + item.fieldValue + "'> " + item.valueComment + "</option>");
            });
        }
    };

    $this = this;
    $.getJSON(url, function (data) {
        $this.dictData = data;
    });
 }

